package com.javasea.patterns.mario;

/**
 *@ClassName Demo
 *@Description TODO
 *@Author longxiaonan@163.com
 *@Date 2022/4/28 0028 22:45
 */
public class Demo {

    /**
     *  测试的状态转换 参考 readme 中的状态图
     * @param args
     */
    public static void main(String[] args) {
        MarioStateContext context = new MarioStateContext();
        System.out.println(context.getCurrentState());
        System.out.println(context.getScore());

        // 吃了蘑菇，期望：score: 100; state: super
        context.obtainMushRoom();
        System.out.println("1>>"+context.getCurrentState());
        System.out.println("1>>"+context.getScore());

        // 获得斗篷，期望：score: 300; state: cape
        context.obtainCape();
        System.out.println("2>>"+context.getCurrentState());
        System.out.println("2>>"+context.getScore());

        // 获得烟花，期望：score: 300; state: cape     do nothing...
        context.obtainFireFlower();
        System.out.println("3>>"+context.getCurrentState());
        System.out.println("3>>"+context.getScore());

        // 遇到怪物，期望：score: 100; state: small
        context.meetMonster();
        System.out.println("4>>"+context.getCurrentState());
        System.out.println("4>>"+context.getScore());

        // 再获得烟花，期望：score: 400; state: fire
        context.obtainFireFlower();
        System.out.println("5>>"+context.getCurrentState());
        System.out.println("5>>"+context.getScore());
    }

}
